package com.googlecode.gwt_control.client;

import com.google.gwt.user.client.ui.FormPanel.SubmitEvent;
import com.google.gwt.user.client.ui.FormPanel.SubmitHandler;

/**
 *
 * @author Olafur Gauti Gudmundsson
 */
public abstract class LoadPanelSubmitHandler implements SubmitHandler {

    public void onSubmit(SubmitEvent event) {
        ApplicationManager.controller().getApplicationView().increaseLoadCounter();
        try {
            submit(event);
        } finally {
            ApplicationManager.controller().getApplicationView().decreaseLoadCounter();
        }
    }

    public abstract void submit(SubmitEvent event);
}
